<?php echo $this->render('/public/header');?>
<?php use yii\helpers\Url;?>
<div id="main" class="col-xs-12">
		<div class="col-xs-4">
			<div class="layui-form-item">
				<label class="layui-form-label" style="width:100px">部门</label>
				<div class="layui-input-block">
					<select  class="form-control" id="group_id">
						<?php foreach ($this->params['group'] as $k => $v) {?>
						<option value="<?php echo $v['id'];?>"><?php echo $v['group_name'];?></option>
						<?php } ?>
					</select>
				</div>
			</div>
			<div class="layui-form-item">
				<label class="layui-form-label" style="width:100px">工号</label>
				<div class="layui-input-block">
					<input type="text" name="title" id="job_num" lay-verify="title" autocomplete="off" class="layui-input">
				</div>
			</div>
			<div class="layui-form-item">
				<label class="layui-form-label" style="width:100px">中文名</label>
				<div class="layui-input-block">
					<input type="text" id="cn_name" lay-verify="required" autocomplete="off"  class="layui-input">
				</div>
			</div>
			<div class="layui-form-item">
				<label class="layui-form-label" style="width:100px">英文名</label>
				<div class="layui-input-block">
					<input type="text"  id="en_name" lay-verify="required" autocomplete="off"  class="layui-input">
				</div>
			</div>
			<div class="layui-form-item">
				<label class="layui-form-label" style="width:100px">入职时间</label>
				<div class="layui-input-block">
					<input type="text" id="date" lay-verify="required" autocomplete="off"  class="layui-input">
				</div>
			</div>
			<div class="layui-form-item">
				<label class="layui-form-label" style="width:100px">手机号</label>
				<div class="layui-input-block">
					<input type="text" name="title" id="phone" lay-verify="title" autocomplete="off" class="layui-input">
				</div>
			</div>
			<div class="layui-form-item">
				<label class="layui-form-label" style="width:100px">email</label>
				<div class="layui-input-block">
					<input type="text" name="title" id="email" lay-verify="title" autocomplete="off" class="layui-input">
				</div>
			</div>
			<div class="layui-form-item">
				<label class="layui-form-label" style="width:100px">农行工资卡</label>
				<div class="layui-input-block">
					<input type="text" id="bank_num" lay-verify="required" autocomplete="off"  class="layui-input">
				</div>
			</div>
			<div class="layui-form-item">
				<label class="layui-form-label" style="width:100px">服务器编号</label>
				<div class="layui-input-block">
					<input type="text" id="server_num" lay-verify="required" autocomplete="off"  class="layui-input">
				</div>
			</div>
			<button type="submit" class="btn btn-success" onclick="upload_staff()">添加</button>
		</div>
</div>
<script>
	function upload_staff()
	{
		if(layer.confirm('确认提交',{},function(){
			var job_num = $("#job_num").val();
			var name = $("#cn_name").val();
			var en_name = $("#en_name").val();
			var date = $("#date").val();
			var bank_num = $("#bank_num").val();
			var server_num = $("#server_num").val();
			var phone = $("#phone").val();
			var email = $("#email").val();
			var group_id = $("#group_id").val();
			if(!(name&&en_name&&date&&server_num))
			{
				layer.alert("信息录入未完整");return false;
			}
			layer.load(0,{shade:false});
			var url = "<?php echo Url::to(['setting/staff_add_act']);?>";
			var data = {
				job_number:job_num,name:name,en_name:en_name,
				date:date,phone:phone,bank_num:bank_num,
				server_num:server_num,group_id:group_id,email:email,
			};
			$.post(url,data,function(res){
				layer.closeAll('loading');
				if(res.code==1){
					layer.confirm(res.msg,{},function(){
						window.history.go(-1);
					});
				}
				else{
					layer.alert(res.msg);
				}
				
			},'json')
		}));
	}
</script>
<?php echo $this->render('/public/footer');?>